package com.ganbing518.commons.test.annotation.enums;

import com.ganbing518.commons.interfaces.EnumInterface;

import java.util.Arrays;

/**
 * Description:
 *
 * @author gan bing
 * @version V1.0
 * @date 2018-06-25 17:20
 */
public enum ByteEnum implements EnumInterface {

    FIRST((byte) 1, "1"), SECOND((byte) 2, "2");

    ByteEnum(Byte value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    private Byte value;
    private String desc;

    public Byte getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }

    @Override
    public Boolean isExist(Object value) {
        return value instanceof Byte && Arrays.stream(ByteEnum.values()).anyMatch(i -> i.getValue() == value);
    }
}
